#!/bin/bash

#  Rails_Install.sh
#  
#
#  Created by Alok Yadav on 12/05/12.
#  Copyright (c) 2012 http://www.computersnyou.com. All rights reserved.

clear
echo "Script for installing rails with rvm "
echo "http://www.computersnyou.com"
echo ""
sleep 2
echo "###########Startig Installation#################"

brew -v >> /dev/null;
if [ "$?" != "0" ]; then
echo "installing homebrew "
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
else
echo brew found;
fi 

git --version >> /dev/null;
if [ "$?" != "0" ]; then
installing git
brew instal git 
brew install git bash-completion
else
echo git found;
fi 
curl -v >> /dev/null;
if [ "$?" != "0" ]; then
brew install curl 
else
echo curl found;
fi 
gcc -v >> /dev/null;
if [ "$?" != "0" ]; then
clear 
sleep 1
echo gcc compiler not found install xcode 
exit
else
echo gcc compiler found;
fi 


echo "INSTALLING RVM ( ruby version manager )"
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
installing ruby 
rvm install 1.9.3
source ~/.rvm/scripts/rvm
type rvm | head -n 1
rvm use 1.9.3 --default
rvm gemset test create --use 
gem install rails 


clear 
echo "#################################################################"
echo ""
echo "email me alok@computersnyou.com"





